/*
 *
 *    Copyright (c) 2022 Project CHIP Authors
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

// THIS FILE IS GENERATED BY ZAP
// This file is generated from clusters-Commands.ipp.zapt

#include <clusters/JointFabricDatastore/Commands.h>

#include <app/data-model/Decode.h>
#include <app/data-model/StructDecodeIterator.h>
#include <app/data-model/WrappedStructEncoder.h>

namespace chip {
namespace app {
namespace Clusters {
namespace JointFabricDatastore {
namespace Commands {
namespace AddKeySet {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kGroupKeySet), groupKeySet);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kGroupKeySet))
        {
            err = DataModel::Decode(reader, groupKeySet);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace AddKeySet.
namespace UpdateKeySet {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kGroupKeySet), groupKeySet);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kGroupKeySet))
        {
            err = DataModel::Decode(reader, groupKeySet);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace UpdateKeySet.
namespace RemoveKeySet {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kGroupKeySetID), groupKeySetID);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kGroupKeySetID))
        {
            err = DataModel::Decode(reader, groupKeySetID);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace RemoveKeySet.
namespace AddGroup {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kGroupID), groupID);
    encoder.Encode(to_underlying(Fields::kFriendlyName), friendlyName);
    encoder.Encode(to_underlying(Fields::kGroupKeySetID), groupKeySetID);
    encoder.Encode(to_underlying(Fields::kGroupCAT), groupCAT);
    encoder.Encode(to_underlying(Fields::kGroupCATVersion), groupCATVersion);
    encoder.Encode(to_underlying(Fields::kGroupPermission), groupPermission);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kGroupID))
        {
            err = DataModel::Decode(reader, groupID);
        }
        else if (__context_tag == to_underlying(Fields::kFriendlyName))
        {
            err = DataModel::Decode(reader, friendlyName);
        }
        else if (__context_tag == to_underlying(Fields::kGroupKeySetID))
        {
            err = DataModel::Decode(reader, groupKeySetID);
        }
        else if (__context_tag == to_underlying(Fields::kGroupCAT))
        {
            err = DataModel::Decode(reader, groupCAT);
        }
        else if (__context_tag == to_underlying(Fields::kGroupCATVersion))
        {
            err = DataModel::Decode(reader, groupCATVersion);
        }
        else if (__context_tag == to_underlying(Fields::kGroupPermission))
        {
            err = DataModel::Decode(reader, groupPermission);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace AddGroup.
namespace UpdateGroup {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kGroupID), groupID);
    encoder.Encode(to_underlying(Fields::kFriendlyName), friendlyName);
    encoder.Encode(to_underlying(Fields::kGroupKeySetID), groupKeySetID);
    encoder.Encode(to_underlying(Fields::kGroupCAT), groupCAT);
    encoder.Encode(to_underlying(Fields::kGroupCATVersion), groupCATVersion);
    encoder.Encode(to_underlying(Fields::kGroupPermission), groupPermission);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kGroupID))
        {
            err = DataModel::Decode(reader, groupID);
        }
        else if (__context_tag == to_underlying(Fields::kFriendlyName))
        {
            err = DataModel::Decode(reader, friendlyName);
        }
        else if (__context_tag == to_underlying(Fields::kGroupKeySetID))
        {
            err = DataModel::Decode(reader, groupKeySetID);
        }
        else if (__context_tag == to_underlying(Fields::kGroupCAT))
        {
            err = DataModel::Decode(reader, groupCAT);
        }
        else if (__context_tag == to_underlying(Fields::kGroupCATVersion))
        {
            err = DataModel::Decode(reader, groupCATVersion);
        }
        else if (__context_tag == to_underlying(Fields::kGroupPermission))
        {
            err = DataModel::Decode(reader, groupPermission);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace UpdateGroup.
namespace RemoveGroup {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kGroupID), groupID);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kGroupID))
        {
            err = DataModel::Decode(reader, groupID);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace RemoveGroup.
namespace AddAdmin {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kNodeID), nodeID);
    encoder.Encode(to_underlying(Fields::kFriendlyName), friendlyName);
    encoder.Encode(to_underlying(Fields::kVendorID), vendorID);
    encoder.Encode(to_underlying(Fields::kIcac), icac);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kNodeID))
        {
            err = DataModel::Decode(reader, nodeID);
        }
        else if (__context_tag == to_underlying(Fields::kFriendlyName))
        {
            err = DataModel::Decode(reader, friendlyName);
        }
        else if (__context_tag == to_underlying(Fields::kVendorID))
        {
            err = DataModel::Decode(reader, vendorID);
        }
        else if (__context_tag == to_underlying(Fields::kIcac))
        {
            err = DataModel::Decode(reader, icac);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace AddAdmin.
namespace UpdateAdmin {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kNodeID), nodeID);
    encoder.Encode(to_underlying(Fields::kFriendlyName), friendlyName);
    encoder.Encode(to_underlying(Fields::kIcac), icac);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kNodeID))
        {
            err = DataModel::Decode(reader, nodeID);
        }
        else if (__context_tag == to_underlying(Fields::kFriendlyName))
        {
            err = DataModel::Decode(reader, friendlyName);
        }
        else if (__context_tag == to_underlying(Fields::kIcac))
        {
            err = DataModel::Decode(reader, icac);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace UpdateAdmin.
namespace RemoveAdmin {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kNodeID), nodeID);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kNodeID))
        {
            err = DataModel::Decode(reader, nodeID);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace RemoveAdmin.
namespace AddPendingNode {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kNodeID), nodeID);
    encoder.Encode(to_underlying(Fields::kFriendlyName), friendlyName);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kNodeID))
        {
            err = DataModel::Decode(reader, nodeID);
        }
        else if (__context_tag == to_underlying(Fields::kFriendlyName))
        {
            err = DataModel::Decode(reader, friendlyName);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace AddPendingNode.
namespace RefreshNode {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kNodeID), nodeID);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kNodeID))
        {
            err = DataModel::Decode(reader, nodeID);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace RefreshNode.
namespace UpdateNode {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kNodeID), nodeID);
    encoder.Encode(to_underlying(Fields::kFriendlyName), friendlyName);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kNodeID))
        {
            err = DataModel::Decode(reader, nodeID);
        }
        else if (__context_tag == to_underlying(Fields::kFriendlyName))
        {
            err = DataModel::Decode(reader, friendlyName);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace UpdateNode.
namespace RemoveNode {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kNodeID), nodeID);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kNodeID))
        {
            err = DataModel::Decode(reader, nodeID);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace RemoveNode.
namespace UpdateEndpointForNode {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kEndpointID), endpointID);
    encoder.Encode(to_underlying(Fields::kNodeID), nodeID);
    encoder.Encode(to_underlying(Fields::kFriendlyName), friendlyName);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kEndpointID))
        {
            err = DataModel::Decode(reader, endpointID);
        }
        else if (__context_tag == to_underlying(Fields::kNodeID))
        {
            err = DataModel::Decode(reader, nodeID);
        }
        else if (__context_tag == to_underlying(Fields::kFriendlyName))
        {
            err = DataModel::Decode(reader, friendlyName);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace UpdateEndpointForNode.
namespace AddGroupIDToEndpointForNode {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kNodeID), nodeID);
    encoder.Encode(to_underlying(Fields::kEndpointID), endpointID);
    encoder.Encode(to_underlying(Fields::kGroupID), groupID);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kNodeID))
        {
            err = DataModel::Decode(reader, nodeID);
        }
        else if (__context_tag == to_underlying(Fields::kEndpointID))
        {
            err = DataModel::Decode(reader, endpointID);
        }
        else if (__context_tag == to_underlying(Fields::kGroupID))
        {
            err = DataModel::Decode(reader, groupID);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace AddGroupIDToEndpointForNode.
namespace RemoveGroupIDFromEndpointForNode {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kNodeID), nodeID);
    encoder.Encode(to_underlying(Fields::kEndpointID), endpointID);
    encoder.Encode(to_underlying(Fields::kGroupID), groupID);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kNodeID))
        {
            err = DataModel::Decode(reader, nodeID);
        }
        else if (__context_tag == to_underlying(Fields::kEndpointID))
        {
            err = DataModel::Decode(reader, endpointID);
        }
        else if (__context_tag == to_underlying(Fields::kGroupID))
        {
            err = DataModel::Decode(reader, groupID);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace RemoveGroupIDFromEndpointForNode.
namespace AddBindingToEndpointForNode {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kNodeID), nodeID);
    encoder.Encode(to_underlying(Fields::kEndpointID), endpointID);
    encoder.Encode(to_underlying(Fields::kBinding), binding);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kNodeID))
        {
            err = DataModel::Decode(reader, nodeID);
        }
        else if (__context_tag == to_underlying(Fields::kEndpointID))
        {
            err = DataModel::Decode(reader, endpointID);
        }
        else if (__context_tag == to_underlying(Fields::kBinding))
        {
            err = DataModel::Decode(reader, binding);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace AddBindingToEndpointForNode.
namespace RemoveBindingFromEndpointForNode {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kListID), listID);
    encoder.Encode(to_underlying(Fields::kEndpointID), endpointID);
    encoder.Encode(to_underlying(Fields::kNodeID), nodeID);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kListID))
        {
            err = DataModel::Decode(reader, listID);
        }
        else if (__context_tag == to_underlying(Fields::kEndpointID))
        {
            err = DataModel::Decode(reader, endpointID);
        }
        else if (__context_tag == to_underlying(Fields::kNodeID))
        {
            err = DataModel::Decode(reader, nodeID);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace RemoveBindingFromEndpointForNode.
namespace AddACLToNode {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kNodeID), nodeID);
    encoder.Encode(to_underlying(Fields::kACLEntry), ACLEntry);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kNodeID))
        {
            err = DataModel::Decode(reader, nodeID);
        }
        else if (__context_tag == to_underlying(Fields::kACLEntry))
        {
            err = DataModel::Decode(reader, ACLEntry);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace AddACLToNode.
namespace RemoveACLFromNode {

CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const
{
    DataModel::WrappedStructEncoder encoder{ aWriter, aTag };
    encoder.Encode(to_underlying(Fields::kListID), listID);
    encoder.Encode(to_underlying(Fields::kNodeID), nodeID);
    return encoder.Finalize();
}

CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader)
{
    detail::StructDecodeIterator __iterator(reader);
    while (true)
    {
        uint8_t __context_tag = 0;
        CHIP_ERROR err        = __iterator.Next(__context_tag);
        VerifyOrReturnError(err != CHIP_ERROR_END_OF_TLV, CHIP_NO_ERROR);
        ReturnErrorOnFailure(err);

        if (__context_tag == to_underlying(Fields::kListID))
        {
            err = DataModel::Decode(reader, listID);
        }
        else if (__context_tag == to_underlying(Fields::kNodeID))
        {
            err = DataModel::Decode(reader, nodeID);
        }

        ReturnErrorOnFailure(err);
    }
}
} // namespace RemoveACLFromNode.
} // namespace Commands
} // namespace JointFabricDatastore
} // namespace Clusters
} // namespace app
} // namespace chip
